package kr.co.handysoft.project.smartPolice.dialog;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.widgets.Text;

public class CreateReceiverServerDialog extends Dialog {

	protected Object result;
	protected Shell shell;
	private Text text;

	/**
	 * Create the dialog.
	 * @param parent
	 * @param style
	 */
	public CreateReceiverServerDialog(Shell parent, int style) {
		super(parent, style);
	}

	/**
	 * Open the dialog.
	 * @return the result
	 */
	public Object open() {
		createContents();
		shell.open();
		shell.layout();
		
        Rectangle shellBounds = getParent().getBounds();
        Point dialogSize = shell.getSize();

		shell.setLocation(shellBounds.x + (shellBounds.width - dialogSize.x) / 2,
		          shellBounds.y + (shellBounds.height - dialogSize.y) / 2);
		
		text = new Text(shell, SWT.BORDER);
		text.setBounds(196, 138, 113, 18);

		Display display = getParent().getDisplay();
		
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return result;
	}

	/**
	 * Create contents of the dialog.
	 */
	private void createContents() {
		shell = new Shell(getParent(), getStyle());
		shell.setSize(470, 335);
		shell.setText("\uC218\uC2E0 \uC11C\uBC84 \uC0DD\uC131");
		
		Composite composite = new Composite(shell, SWT.NONE);
		composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
		composite.setBounds(0, 0, 464, 64);
		
		CLabel lblNewLabel = new CLabel(shell, SWT.NONE);
		lblNewLabel.setImage(SWTResourceManager.getImage(CreateReceiverServerDialog.class, "/com/famfamfam/slik/icons/bullet_green.png"));
		lblNewLabel.setBounds(59, 138, 131, 21);
		lblNewLabel.setText("\uB9AC\uC2A4\uB2DD \uD3EC\uD2B8 \uC9C0\uC815");
		
		Button btnNewButton = new Button(shell, SWT.NONE);
		btnNewButton.setImage(SWTResourceManager.getImage(CreateReceiverServerDialog.class, "/com/famfamfam/slik/icons/computer.png"));
		btnNewButton.setBounds(315, 133, 76, 25);
		btnNewButton.setText("\uC0DD\uC131");
	}
}
